package cn.shentianlan.controller;

import cn.shentianlan.criteria.TransactionProcessingCriteria;
import cn.shentianlan.domain.dto.TransactionProcessingDTO;
import cn.shentianlan.service.TransactionProcessingService;
import cn.shentianlan.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 陈俊源
 * @Description TODO
 * @Date 2021/5/7
 * @Version 1.0
 */
@RestController
@RequestMapping("/transactionProcessing")
public class TransactionProcessingController {

    @Autowired
    private TransactionProcessingService transactionProcessingService;

    @PostMapping("/saveOrUpdate")
    public Result saveOrUpdate(@RequestBody TransactionProcessingDTO dto){
        Result result = transactionProcessingService.saveOrUpdate(dto);
        return result;
    }

    @PostMapping("/list")
    public Result findTransactionProcessingByCriteria(TransactionProcessingCriteria criteria){
        Result result = transactionProcessingService.findTransactionProcessingByCriteria(criteria);
        return result;
    }

    @PostMapping("/delete")
    public Result delete(Long id){
        Result result = transactionProcessingService.delete(id);
        return result;
    }

    @RequestMapping("/getTransactionProcessing")
    public Result getTransactionProcessing(Long id){
        Result result = transactionProcessingService.getTransactionProcessing(id);
        return result;
    }
}
